package com.wzl.backend.common;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class Result {

    private Object data;
    private String msg;
    private int  code;

    public static Result ok() {
        return new Result(null , ResponseCode.OK.getMessage() , ResponseCode.OK.getCode());
    }

    public static Result ok(Object data) {
        return new Result(data ,  ResponseCode.OK.getMessage() , ResponseCode.OK.getCode());
    }

    public static Result fail(ResponseCode code) {
        return new Result(null , code.getMessage() , 400);
    }

    public static Result fail(String msg , ResponseCode code) {
        return new Result(null , msg , code.getCode());
    }


}
